package com.javaee.service.admin.impl;

import com.javaee.entity.Doctor;
import com.javaee.entity.Plan;
import com.javaee.mapper.admin.PlanMapper;
import com.javaee.service.admin.PlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PlanServiceImpl implements PlanService {
    @Autowired
    private PlanMapper planMapper;
    @Override
    public List<Plan> findAll() {
        return planMapper.findAll();
    }
    @Override
    public List<Doctor> finddoctorbyName(){
           return planMapper.finddoctorbyName();
     }

    @Override
    public Plan findById(Integer id) {
        return planMapper.findById(id);
    }

    @Override
    public void save(Plan plan) {
        planMapper.insert(plan);
    }

    @Override
    public void update(Plan plan) {
        planMapper.update(plan);
    }

    @Override
    public void deleteById(Integer id) {
        planMapper.deleteById(id);
    }
    @Override
    public List<Plan> findAllWithDoctor(String keyword,int pageNum, int pageSize) {
        List<Plan> plans = planMapper.findAllWithDoctor(keyword,pageNum,pageSize);
        return plans;
    }

    @Override
    public List<Plan> findByDepartmentName(String departmentName) {
        return planMapper.findByDepartmentName(departmentName);
    }


    @Override
    public int selectCount() {
        return planMapper.selectCount();
    }

}